home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Balloons.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  9.5 KB  |  269 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Balloons.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Balloons;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __BALLOONS__}
  27. {$SETC __BALLOONS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC BalloonsIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __QUICKDRAW__}
  40. {$I Quickdraw.p}
  41. {$ENDC}
  42. {    MixedMode.p                                                    }
  43. {    QuickdrawText.p                                                }
  44.  
  45. {$IFC UNDEFINED __MENUS__}
  46. {$I Menus.p}
  47. {$ENDC}
  48. {    Memory.p                                                    }
  49. {    Events.p                                                    }
  50. {        OSUtils.p                                                }
  51.  
  52. {$IFC UNDEFINED __TEXTEDIT__}
  53. {$I TextEdit.p}
  54. {$ENDC}
  55.  
  56. {$IFC UNDEFINED __ERRORS__}
  57. {$I Errors.p}
  58. {$ENDC}
  59.  
  60. {$PUSH}
  61. {$ALIGN MAC68K}
  62. {$LibExport+}
  63.  
  64. CONST
  65.     hmBalloonHelpVersion        = $0002;                        { The real version of the Help Manager }
  66.     kHMHelpMenuID                = -16490;                        { Resource ID and menu ID of help menu }
  67.     kHMAboutHelpItem            = 1;                            { help menu item number of About Balloon Help… }
  68.     kHMShowBalloonsItem            = 3;                            { help menu item number of Show/Hide Balloons }
  69.     kHMHelpID                    = -5696;                        { ID of various Help Mgr package resources (in Pack14 range) }
  70.     kBalloonWDEFID                = 126;                            { Resource ID of the WDEF proc used in standard balloons }
  71. { Dialog item template type constant }
  72.     helpItem                    = 1;                            { key value in DITL template that corresponds to the help item }
  73. { Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources }
  74.     hmDefaultOptions            = 0;                            { default options for help manager resources }
  75.     hmUseSubID                    = 1;                            { treat resID's in resources as subID's of driver base ID (for Desk Accessories) }
  76.     hmAbsoluteCoords            = 2;                            { ignore window port origin and treat rectangles as absolute coords (local to window) }
  77.  
  78.     hmSaveBitsNoWindow            = 4;                            { don't create a window, just blast bits on screen. No update event is generated }
  79.     hmSaveBitsWindow            = 8;                            { create a window, but restore bits behind window when window goes away & generate update event }
  80.     hmMatchInTitle                = 16;                            { for hwin resources, match string anywhere in window title string }
  81. { Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources }
  82.     kHMStringItem                = 1;                            { pstring used in resource }
  83.     kHMPictItem                    = 2;                            { 'PICT' ResID used in resource }
  84.     kHMStringResItem            = 3;                            { 'STR#' ResID & index used in resource }
  85.     kHMTEResItem                = 6;                            { Styled Text Edit ResID used in resource ('TEXT' & 'styl') }
  86.     kHMSTRResItem                = 7;                            { 'STR ' ResID used in resource }
  87.     kHMSkipItem                    = 256;                            { don't display a balloon }
  88.     kHMCompareItem                = 512;                            { Compare pstring in menu item w/ PString in resource item ('hmnu' only) }
  89.     kHMNamedResourceItem        = 1024;                            { Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) }
  90.     kHMTrackCntlItem            = 2048;                            { Reserved }
  91. { Constants for hmmHelpType's when filling out HMMessageRecord }
  92.     khmmString                    = 1;                            { help message contains a PString }
  93.     khmmPict                    = 2;                            { help message contains a resource ID to a 'PICT' resource }
  94.     khmmStringRes                = 3;                            { help message contains a res ID & index to a 'STR#' resource }
  95.     khmmTEHandle                = 4;                            { help message contains a Text Edit handle }
  96.     khmmPictHandle                = 5;                            { help message contains a Picture handle }
  97.     khmmTERes                    = 6;                            { help message contains a res ID to 'TEXT' & 'styl' resources }
  98.     khmmSTRRes                    = 7;                            { help message contains a res ID to a 'STR ' resource }
  99.     kHMEnabledItem                = 0;                            { item is enabled, but not checked or control value = 0 }
  100.  
  101. { ResTypes for Styled TE Handles in Resources }
  102.     kHMTETextResType            = 'TEXT';                        { Resource Type of text data for styled TE record w/o style info }
  103.     kHMTEStyleResType            = 'styl';
  104.  
  105.     kHMDisabledItem                = 1;                            { item is disabled, grayed in menus or disabled in dialogs }
  106.     kHMCheckedItem                = 2;                            { item is enabled, and checked or control value = 1 }
  107.     kHMOtherItem                = 3;                            { item is enabled, and control value > 1 }
  108. { Method parameters to pass to HMShowBalloon }
  109.     kHMRegularWindow            = 0;                            { Create a regular window floating above all windows }
  110.     kHMSaveBitsNoWindow            = 1;                            { Just save the bits and draw (for MDEF calls) }
  111.     kHMSaveBitsWindow            = 2;                            { Regular window, save bits behind, AND generate update event }
  112.  
  113. { Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages }
  114.     kHMMenuResType                = 'hmnu';                        { ResType of help resource for supporting menus }
  115.     kHMDialogResType            = 'hdlg';                        { ResType of help resource for supporting dialogs }
  116.     kHMWindListResType            = 'hwin';                        { ResType of help resource for supporting windows }
  117.     kHMRectListResType            = 'hrct';                        { ResType of help resource for rectangles in windows }
  118.     kHMOverrideResType            = 'hovr';                        { ResType of help resource for overriding system balloons }
  119.     kHMFinderApplResType        = 'hfdr';
  120.  
  121.  
  122. TYPE
  123.     HMStringResType = RECORD
  124.         hmmResID:                INTEGER;
  125.         hmmIndex:                INTEGER;
  126.     END;
  127.     HMMessageRecord = RECORD
  128.         hmmHelpType:            SInt16;
  129.         CASE INTEGER OF
  130.         0: (
  131.             hmmString:                    Str255;
  132.            );
  133.         1: (
  134.             hmmPict:                    SInt16;
  135.            );
  136.         2: (
  137.             hmmTEHandle:                TEHandle;
  138.            );
  139.         3: (
  140.             hmmStringRes:                HMStringResType;
  141.            );
  142.         4: (
  143.             hmmPictRes:                    SInt16;
  144.            );
  145.         5: (
  146.             hmmPictHandle:                PicHandle;
  147.            );
  148.         6: (
  149.             hmmTERes:                    SInt16;
  150.            );
  151.         7: (
  152.             hmmSTRRes:                    SInt16;
  153.            );
  154.     END;
  155.     HMMessageRecPtr = ^HMMessageRecord;
  156.  
  157.     TipFunctionProcPtr = ProcPtr;  { FUNCTION TipFunction(tip: Point; structure: RgnHandle; VAR r: Rect; VAR balloonVariant: INTEGER): OSErr; }
  158.     TipFunctionUPP = UniversalProcPtr;
  159.  
  160. CONST
  161.     uppTipFunctionProcInfo = $00003FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
  162.  
  163. FUNCTION NewTipFunctionProc(userRoutine: TipFunctionProcPtr): TipFunctionUPP;
  164.     {$IFC NOT GENERATINGCFM }
  165.     INLINE $2E9F;
  166.     {$ENDC}
  167.  
  168. FUNCTION CallTipFunctionProc(tip: Point; structure: RgnHandle; VAR r: Rect; VAR balloonVariant: INTEGER; userRoutine: TipFunctionUPP): OSErr;
  169.     {$IFC NOT GENERATINGCFM}
  170.     INLINE $205F, $4E90;
  171.     {$ENDC}
  172. {  Public Interfaces  }
  173.  
  174. FUNCTION HMGetHelpMenuHandle(VAR mh: MenuHandle): OSErr;
  175.     {$IFC NOT GENERATINGCFM}
  176.     INLINE $303C, $0200, $A830;
  177.     {$ENDC}
  178. FUNCTION HMShowBalloon({CONST}VAR aHelpMsg: HMMessageRecord; tip: Point; alternateRect: RectPtr; tipProc: TipFunctionUPP; theProc: SInt16; balloonVariant: SInt16; method: SInt16): OSErr;
  179.     {$IFC NOT GENERATINGCFM}
  180.     INLINE $303C, $0B01, $A830;
  181.     {$ENDC}
  182. FUNCTION HMRemoveBalloon: OSErr;
  183.     {$IFC NOT GENERATINGCFM}
  184.     INLINE $303C, $0002, $A830;
  185.     {$ENDC}
  186. FUNCTION HMGetBalloons: BOOLEAN;
  187.     {$IFC NOT GENERATINGCFM}
  188.     INLINE $303C, $0003, $A830;
  189.     {$ENDC}
  190. FUNCTION HMSetBalloons(flag: BOOLEAN): OSErr;
  191.     {$IFC NOT GENERATINGCFM}
  192.     INLINE $303C, $0104, $A830;
  193.     {$ENDC}
  194. FUNCTION HMShowMenuBalloon(itemNum: SInt16; itemMenuID: SInt16; itemFlags: SInt32; itemReserved: SInt32; tip: Point; alternateRect: RectPtr; tipProc: TipFunctionUPP; theProc: SInt16; balloonVariant: SInt16): OSErr;
  195.     {$IFC NOT GENERATINGCFM}
  196.     INLINE $303C, $0E05, $A830;
  197.     {$ENDC}
  198. FUNCTION HMGetIndHelpMsg(whichType: ResType; whichResID: SInt16; whichMsg: SInt16; whichState: SInt16; VAR options: UInt32; VAR tip: Point; VAR altRect: Rect; VAR theProc: SInt16; VAR balloonVariant: SInt16; VAR aHelpMsg: HMMessageRecord; VAR count: SInt16): OSErr;
  199.     {$IFC NOT GENERATINGCFM}
  200.     INLINE $303C, $1306, $A830;
  201.     {$ENDC}
  202. FUNCTION HMIsBalloon: BOOLEAN;
  203.     {$IFC NOT GENERATINGCFM}
  204.     INLINE $303C, $0007, $A830;
  205.     {$ENDC}
  206. FUNCTION HMSetFont(font: SInt16): OSErr;
  207.     {$IFC NOT GENERATINGCFM}
  208.     INLINE $303C, $0108, $A830;
  209.     {$ENDC}
  210. FUNCTION HMSetFontSize(fontSize: UInt16): OSErr;
  211.     {$IFC NOT GENERATINGCFM}
  212.     INLINE $303C, $0109, $A830;
  213.     {$ENDC}
  214. FUNCTION HMGetFont(VAR font: SInt16): OSErr;
  215.     {$IFC NOT GENERATINGCFM}
  216.     INLINE $303C, $020A, $A830;
  217.     {$ENDC}
  218. FUNCTION HMGetFontSize(VAR fontSize: UInt16): OSErr;
  219.     {$IFC NOT GENERATINGCFM}
  220.     INLINE $303C, $020B, $A830;
  221.     {$ENDC}
  222. FUNCTION HMSetDialogResID(resID: SInt16): OSErr;
  223.     {$IFC NOT GENERATINGCFM}
  224.     INLINE $303C, $010C, $A830;
  225.     {$ENDC}
  226. FUNCTION HMSetMenuResID(menuID: SInt16; resID: SInt16): OSErr;
  227.     {$IFC NOT GENERATINGCFM}
  228.     INLINE $303C, $020D, $A830;
  229.     {$ENDC}
  230. FUNCTION HMBalloonRect({CONST}VAR aHelpMsg: HMMessageRecord; VAR coolRect: Rect): OSErr;
  231.     {$IFC NOT GENERATINGCFM}
  232.     INLINE $303C, $040E, $A830;
  233.     {$ENDC}
  234. FUNCTION HMBalloonPict({CONST}VAR aHelpMsg: HMMessageRecord; VAR coolPict: PicHandle): OSErr;
  235.     {$IFC NOT GENERATINGCFM}
  236.     INLINE $303C, $040F, $A830;
  237.     {$ENDC}
  238. FUNCTION HMScanTemplateItems(whichID: SInt16; whichResFile: SInt16; whichType: ResType): OSErr;
  239.     {$IFC NOT GENERATINGCFM}
  240.     INLINE $303C, $0410, $A830;
  241.     {$ENDC}
  242. FUNCTION HMExtractHelpMsg(whichType: ResType; whichResID: SInt16; whichMsg: SInt16; whichState: SInt16; VAR aHelpMsg: HMMessageRecord): OSErr;
  243.     {$IFC NOT GENERATINGCFM}
  244.     INLINE $303C, $0711, $A830;
  245.     {$ENDC}
  246. FUNCTION HMGetDialogResID(VAR resID: SInt16): OSErr;
  247.     {$IFC NOT GENERATINGCFM}
  248.     INLINE $303C, $0213, $A830;
  249.     {$ENDC}
  250. FUNCTION HMGetMenuResID(menuID: SInt16; VAR resID: SInt16): OSErr;
  251.     {$IFC NOT GENERATINGCFM}
  252.     INLINE $303C, $0314, $A830;
  253.     {$ENDC}
  254. FUNCTION HMGetBalloonWindow(VAR window: WindowRef): OSErr;
  255.     {$IFC NOT GENERATINGCFM}
  256.     INLINE $303C, $0215, $A830;
  257.     {$ENDC}
  258.  
  259. {$ALIGN RESET}
  260. {$POP}
  261.  
  262. {$SETC UsingIncludes := BalloonsIncludes}
  263.  
  264. {$ENDC} {__BALLOONS__}
  265.  
  266. {$IFC NOT UsingIncludes}
  267.  END.
  268. {$ENDC}
  269.